package com.boolib.aop.web;

import com.boolib.aop.config.MethodBeforeAop;
import com.boolib.aop.util.SpringUtil;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WebController {


    @Autowired
    private MethodBeforeAop methodBeforeAop;

    @GetMapping("proxy")
    public Object test(){
        SpringUtil.replaceProxyBean("reController",methodBeforeAop);
        return "success";
    }

    @GetMapping("unproxy")
    public Object test2(){
        SpringUtil.recoverProxyBean("reController");
        return "success";
    }
}
